<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');

require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');

class ModHelloWorld2Helper
{
    /**
     * Returns a list of post items
    */
    public function getItems($params)
    {
    	
		$db		=& JFactory::getDBO();
		$catid	= trim( $params->get('catid') );
		
        $db = &JFactory::getDBO();
 
        $query = 'SELECT a.* FROM #__content AS a  where a.state != -2 and a.catid = '. $catid ;
 
        $db->setQuery($query);
        $items = ($items = $db->loadObjectList())?$items:array();
        $lists	= array();
        foreach ( $items as $row ) {
			if($row->access <= $aid)
			{
				$lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
			} else {
				$lists[$i]->link = ContentHelperRoute::getArticleRoute($row->id, $catid = $row->catid, $sectionid = $row->sectionid);
			}
			$lists[$i]->text = htmlspecialchars( $row->title );
			$i++;
		}
        return $lists;
    } 
 
} 
?>